package com.hyh.music.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hyh.music.domain.domainDTO.ConsumerPageDTO;
import com.hyh.music.domain.domains.Consumer;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @author hyh
 * @version 1.0
 */
@Mapper
public interface ConsumerMapper extends BaseMapper<Consumer> {

    /**
     * 查询所有
     * @param consumerPageDTO
     * @return
     */
    List<Consumer> page(ConsumerPageDTO consumerPageDTO);

    /**
     * 添加新用户
     * @param consumer
     */
    @Insert("insert into consumer (username, password, sex, phone_num, email, birth, introduction, location, avatar, create_time, update_time) " +
            "values (#{username},#{password},#{sex},#{phoneNum},#{email},#{birth},#{introduction},#{location},#{avatar},#{createTime},#{updateTime})")
    void add(Consumer consumer);

    /**
     * 删除
     * @param id
     */
    @Delete("delete from consumer where id = #{id}")
    void delete(Integer id);
}
